/**
 * 配置编译开发和生产环境域名切换
 * 
 *         case 'pre':
            root.domains = {
                img: function() {
                    return '//uimgpre.cnsuning.com';
                },
                xd: '//snxdpre.cnsuning.com',
                mob: '//mobimsgpre.cnsuning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
                cms: '//cmspre.api.cnsuning.com',
                pro: '//shoppingpre-snxd.cnsuning.com/cmwspds-web',
                tps: '//paypre-snxd.cnsuning.com',
                poi: '//snxdpre.cnsuning.com',
                myapi: '//mypre.cnsuning.com',http://shopping-snxd.suning.com
                mres: '//res.mpre.cnsuning.com',
                cmslib: '//libpre.cnsuning.com',
                review: '//reviewpre.cnsuning.com',
                ms: '//snxdpre.cnsuning.com/cmwsps-web',
                pcss: '//pcsslabelpre.cnsuning.com/pcss-web'
            };
            break;
        case 'sit':
            root.domains = {
                img: function() {
                    return '//uimgpre.cnsuning.com';
                },
                xd: '//snxdsit.cnsuning.com',
                mob: '//mobimsgsit.cnsuning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
                cms: '//cmssit.api.cnsuning.com',
                pro: '//shoppingsit-snxd.cnsuning.com/cmwspds-web',
                tps: '//paysit-snxd.cnsuning.com',
                poi: '//snxdsit.cnsuning.com',
                myapi: '//mysit.cnsuning.com',
                mres: '//res.msit.cnsuning.com',
                cmslib: '//libsit.cnsuning.com',
                review: '//reviewsit.cnsuning.com',
                ms: '//snxdsit.cnsuning.com/cmwsps-web',
                pcss: '//pcsslabelsit.cnsuning.com/pcss-web'
            };
            break;
        case 'prd':
            root.domains = {
                img: function() {
                    var n = parseInt(Math.random()*5+1);
                    return '//image' + n + '.suning.cn'
                },
                xd: '//ls.xd.suning.com',
                mob: '//mobts.suning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
                cms: '//cms.api.suning.com',
                pro: '//shopping-snxd.suning.com/cmwspds-web',
                tps: '//pay-snxd.suning.com',
                poi: '//snxd.suning.com',
                myapi: '//myapi.suning.com',
                mres: '//res.m.suning.com',
                cmslib: '//lib.suning.com',
                review: '//review.suning.com',
                ms: '//snxd.suning.com/cmwsps-web',
                pcss: '//pcsslabel.suning.cn/pcss-web'
            };
            break;
 */
function getEnv() {
    var ego_pre_reg = /^(.*)(pre)(.*)(.cnsuning.com)$/,
        ego_sit_reg = /^(.*)([^2]sit)(.*)(.cnsuning.com)$/,
        ego_sit2_reg = /^(.*)(2sit)(.*)(.cnsuning.com)$/,
        _hostName = window.location.hostname;
    if (ego_pre_reg.test(_hostName)) {
    	return 'pre';
    } else if (ego_sit_reg.test(_hostName)) {
        return 'sit';
    } else if (ego_sit2_reg.test(_hostName)) {
        return 'sit2';
    }
    return 'prd';
}

switch (getEnv()) {
    case 'pre':
        // pre
        var img = () => {
            return '//uimgpre.cnsuning.com';
        },
        routerMode = 'hash',
        ls = '//lspre-snxd.cnsuning.com',
        mres = '//res.mpre.cnsuning.com',
        my = '//mypre.cnsuning.com',
        aq = 'https://aqpre.cnsuning.com',
        snxd = '//snxdpre.cnsuning.com/cmwsmdm-web',
        icp = '//icpspre.cnsuning.com',
        cmslib = 'https://libpre.cnsuning.com',

        comment = '//reviewpre.cnsuning.com',
        imgdetail = 'https://product.mpre.cnsuning.com'
        poi = '//snxdpre.cnsuning.com',
        tps = '//paypre-snxd.cnsuning.com',
        shop = '//shoppingpre-snxd.cnsuning.com',
        pro = '//shoppingpre-snxd.cnsuning.com/cmwspds-web',
        wpay = 'https://wpaypre.cnsuning.com',
        mdm = '//mdm.xdpre.cnsuning.com',
        mobts = '//mobimsgpre.cnsuning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
        order = '//orderpre.cnsuning.com',
        pua = 'https://puapre.cnsuning.com',
        pcss= '//pcsslabelpre.cnsuning.com/pcss-web'
        break;
    case 'sit':
        var img = () => {
            return '//uimgsit.cnsuning.com';
        },
        routerMode = 'hash',
        ls = '//lssit-snxd.cnsuning.com',
        mres = '//res.msit.cnsuning.com',   
        my = '//mysit.cnsuning.com',
        aq = 'https://aqsit.cnsuning.com',
        snxd = '//snxdsit.cnsuning.com/cmwsmdm-web',
        cmslib = 'https://libsit.cnsuning.com',
        mdm = '//mdm.xdsit.cnsuning.com',
        comment = '//reviewsit.cnsuning.com',
        imgdetail = 'https://product.msit.cnsuning.com'
        poi = '//snxdsit.cnsuning.com',
        tps = '//paysit-snxd.cnsuning.com',
        shop = '//shoppingsit-snxd.cnsuning.com',
        pro = '//shoppingsit-snxd.cnsuning.com/cmwspds-web',
        wpay = 'https://wpaysit.cnsuning.com',
        mobts = '//mobimsgsit.cnsuning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
        order = '//ordersit.cnsuning.com',
        pua = 'https://puasit.cnsuning.com',
        icp = '//icpssit.cnsuning.com',
        pcss= '//pcsslabelsit.cnsuning.com/pcss-web'
        break;
    case 'prd':
        // 生产
        var img = () => {
        let n = parseInt(Math.random() * 5 + 1);
        return '//image' + n + '.suning.cn'
        },
        routerMode = 'hash',
        ls = '//ls-snxd.suning.com',
        mres = '//res.m.suning.com',
        my = '//myapi.suning.com',
        aq = 'https://aq.suning.com',
        snxd = '//snxd.suning.com/cmwsmdm-web',
        cmslib = 'https://lib.suning.com',
        mdm = '//snxd.suning.com',
        comment = '//review.suning.com',
        imgdetail = 'https://product.m.suning.com',
        poi = '//snxd.suning.com',
        tps = '//pay-snxd.suning.com',
        shop = '//snxd.suning.com',
        pro = '//shopping-snxd.suning.com/cmwspds-web',
        wpay = 'https://wpay.suning.com',
        mobts = '//mobts.suning.com/suning-web-mobile/weixin/auth.htm?weixinRedirectUrl=',
        order = '//order.suning.com',
        pua = 'https://pas.suning.com',
        icp = '//icps.suning.com',
        pcss= '//pcsslabel.suning.cn/pcss-web'
        break;
};


export {
	pro,
    routerMode, 
    img, 
    mdm,
    my, 
    aq, 
    snxd, 
    cmslib, 
    tps, 
    shop,
    wpay,
    imgdetail,
    comment,
    mobts,
    poi,
    order,
    ls,
    mres,
    pua,
    icp,
    pcss
}